---
title: SWI-Prolog
---

SWI-Prolog offers a comprehensive free Prolog environment.

## Installation and Setup

Once SWI-Prolog has been installed, install lanchain-prolog using pip:

<CodeGroup>
```bash pip
pip install langchain-prolog
```

```bash uv
uv add langchain-prolog
```
</CodeGroup>

## Tools

The `PrologTool` class allows the generation of langchain tools that use Prolog rules to generate answers.

```python
from langchain_prolog import PrologConfig, PrologTool
```

See a [usage example](/oss/integrations/tools/prolog_tool).

See the same guide for usage examples of `PrologRunnable`, which allows the generation
of LangChain runnables that use Prolog rules to generate answers.
